home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 36 / Amiga Format CD36 (1999-01-22)(Future Publishing)(GB)[!][issue 1999-02].iso / -seriously_amiga- / graphics / gfx3d.library / examples / minifrog.c < prev    next >
C/C++ Source or Header  |  1998-12-12  |  43KB  |  1,030 lines

  1.  
  2. #define WIDTH 160
  3. #define HEIGHT 100
  4. #define DEPTH 8
  5. #define SIZE WIDTH*HEIGHT
  6. #define BPLSIZE SIZE/DEPTH
  7.  
  8.  
  9.  
  10. #define NULL   0
  11.  
  12. #define GFX_POLYGON      1
  13. #define GFX_FRAME        2
  14. #define GFX_ENVIRONMENT  3
  15. #define GFX_OBJECT       4
  16. #define GFX_CAMERA       5
  17. #define GFX_SHADETABLE   6
  18.  
  19. #define GFX_NONE   0
  20.  
  21. #define GFX_FILL_SHADING      0
  22. #define GFX_FLAT_SHADING      1
  23. #define GFX_DEPTH_CUEING      2
  24. #define GFX_DEPTH_SHADING     2
  25.  
  26.  
  27.  
  28. /******************/
  29. /*                */
  30. /* STRUTTURE DATI */
  31. /*                */
  32. /******************/
  33.  
  34. #define MEMF_PUBLIC  0x00001
  35. #define MEMF_CHIP    0x00002
  36. #define MEMF_FAST    0x00004
  37. #define MEMF_CLEAR   0x10000
  38. #define MEMF_LARGEST 0x20000
  39.  
  40. typedef struct BitMap
  41. {
  42.    short BytesPerRow;
  43.    short Rows;
  44.    char Flags;
  45.    char Depth;
  46.    short Pad;
  47.    void * Planes[8];
  48. } BitMap;
  49.  
  50. typedef struct NewScreen
  51. {
  52.    short LeftEdge, TopEdge;
  53.    short Width, Height;
  54.    short Depth;
  55.    char DetailPen, BlockPen;
  56.    short ViewModes;
  57.    short Type;
  58.    void * Font;
  59.    char * DefaultTitle;
  60.    void * Gadgets;
  61.    struct BitMap * CustomBitMap;
  62. } NewScreen;
  63.  
  64. #define SCREENTYPE   0x0F
  65. #define WBENCHSCREEN 0x01
  66. #define PUBLICSCREEN 0x02
  67. #define CUSTOMSCREEN 0x0F
  68. #define SHOWTITLE    0x10
  69. #define BEEPING      0x20
  70. #define CUSTOMBITMAP 0x40
  71.  
  72. typedef struct rl_RGB
  73. {
  74.    unsigned char Red, Green, Blue;
  75.    char paddle;
  76. } rl_RGB;
  77.  
  78.  
  79.  
  80. /***************/
  81. /*             */
  82. /*  PROTOTIPI  */
  83. /*             */
  84. /***************/
  85.  
  86. unsigned long ReadJoystick( unsigned long joynum );
  87. long ReadDeltaXMouse (unsigned long portnum);
  88. long ReadDeltaYMouse (unsigned long portnum);
  89. void * BuildFrame( short *points, short *polygons, long scale, long offset );
  90.  
  91.  
  92.  
  93. /***********************/
  94. /*                     */
  95. /*  VARIABILI GLOBALI  */
  96. /*                     */
  97. /***********************/
  98.  
  99. long total=0;
  100.  
  101.  
  102.  
  103. /*************************/
  104. /*                       */
  105. /*  FUNZIONE PRINCIPALE  */
  106. /*                       */
  107. /*************************/
  108.  
  109. void * GfxBase;
  110. void * IntuitionBase;
  111. void * GfX3dBase;
  112.  
  113. struct BitMap MyBitMap;
  114. struct NewScreen MyNewScreen = {
  115.    0, 0, WIDTH, HEIGHT, DEPTH,
  116.    1, 0,
  117.    0,
  118.    CUSTOMSCREEN | CUSTOMBITMAP,
  119.    0,
  120.    "GfX3d shared library v2.1 ©1998",
  121.    0,
  122.    NULL
  123. };
  124. void * MyScreen;
  125. unsigned long *View;
  126. unsigned long ViewPort;
  127. void * memptr;
  128. long trigonometry;
  129. void *polygon, *frame, *object, *env, *cam;
  130. void *groundenv, *groundcam;
  131.  
  132. unsigned long RGB32[] =
  133. {
  134.    0x01000000,0x00000000,0x00000000,0x00000000,0xa0a0a0a0,0xa0a0a0a0,
  135.    0xa0a0a0a0,0x00000000,0xaaaaaaaa,0x00000000,0x00000000,0xaaaaaaaa,
  136.    0xaaaaaaaa,0xaaaaaaaa,0x00000000,0x00000000,0xaaaaaaaa,0x00000000,
  137.    0xaaaaaaaa,0xaaaaaaaa,0x55555555,0x00000000,0xaaaaaaaa,0xaaaaaaaa,
  138.    0xaaaaaaaa,0x55555555,0x55555555,0x55555555,0x55555555,0x55555555,
  139.    0xffffffff,0x55555555,0xffffffff,0x55555555,0x55555555,0xffffffff,
  140.    0xffffffff,0xffffffff,0x55555555,0x55555555,0xffffffff,0x55555555,
  141.    0xffffffff,0xffffffff,0xffffffff,0x55555555,0xffffffff,0xffffffff,
  142.    0xffffffff,0xefefefef,0xefefefef,0xefefefef,0xdfdfdfdf,0xdfdfdfdf,
  143.    0xdfdfdfdf,0xd3d3d3d3,0xd3d3d3d3,0xd3d3d3d3,0xc3c3c3c3,0xc3c3c3c3,
  144.    0xc3c3c3c3,0xb7b7b7b7,0xb7b7b7b7,0xb7b7b7b7,0xabababab,0xabababab,
  145.    0xabababab,0x9b9b9b9b,0x9b9b9b9b,0x9b9b9b9b,0x8f8f8f8f,0x8f8f8f8f,
  146.    0x8f8f8f8f,0x7f7f7f7f,0x7f7f7f7f,0x7f7f7f7f,0x73737373,0x73737373,
  147.    0x73737373,0x67676767,0x67676767,0x67676767,0x57575757,0x57575757,
  148.    0x57575757,0x4b4b4b4b,0x4b4b4b4b,0x4b4b4b4b,0x3b3b3b3b,0x3b3b3b3b,
  149.    0x3b3b3b3b,0x2f2f2f2f,0x2f2f2f2f,0x2f2f2f2f,0x23232323,0x23232323,
  150.    0x23232323,0xffffffff,0x00000000,0x00000000,0xefefefef,0x00000000,
  151.    0x00000000,0xe3e3e3e3,0x00000000,0x00000000,0xd7d7d7d7,0x00000000,
  152.    0x00000000,0xcbcbcbcb,0x00000000,0x00000000,0xbfbfbfbf,0x00000000,
  153.    0x00000000,0xb3b3b3b3,0x00000000,0x00000000,0xa7a7a7a7,0x00000000,
  154.    0x00000000,0x9b9b9b9b,0x00000000,0x00000000,0x8b8b8b8b,0x00000000,
  155.    0x00000000,0x7f7f7f7f,0x00000000,0x00000000,0x73737373,0x00000000,
  156.    0x00000000,0x67676767,0x00000000,0x00000000,0x5b5b5b5b,0x00000000,
  157.    0x00000000,0x4f4f4f4f,0x00000000,0x00000000,0x40404040,0x00000000,
  158.    0x00000000,0xffffffff,0xdadadada,0xdadadada,0xffffffff,0xbabababa,
  159.    0xbabababa,0xffffffff,0x9f9f9f9f,0x9f9f9f9f,0xffffffff,0x7f7f7f7f,
  160.    0x7f7f7f7f,0xffffffff,0x5f5f5f5f,0x5f5f5f5f,0xffffffff,0x40404040,
  161.    0x40404040,0xffffffff,0x20202020,0x20202020,0xffffffff,0x00000000,
  162.    0x00000000,0xfcfcfcfc,0xa8a8a8a8,0x5c5c5c5c,0xfcfcfcfc,0x98989898,
  163.    0x40404040,0xfcfcfcfc,0x88888888,0x20202020,0xfcfcfcfc,0x78787878,
  164.    0x00000000,0xe4e4e4e4,0x6c6c6c6c,0x00000000,0xcccccccc,0x60606060,
  165.    0x00000000,0xb4b4b4b4,0x54545454,0x00000000,0x9c9c9c9c,0x4c4c4c4c,
  166.    0x00000000,0xfcfcfcfc,0xfcfcfcfc,0xd8d8d8d8,0xfcfcfcfc,0xfcfcfcfc,
  167.    0xb8b8b8b8,0xfcfcfcfc,0xfcfcfcfc,0x9c9c9c9c,0xfcfcfcfc,0xfcfcfcfc,
  168.    0x7c7c7c7c,0xfcfcfcfc,0xf8f8f8f8,0x5c5c5c5c,0xfcfcfcfc,0xf4f4f4f4,
  169.    0x40404040,0xfcfcfcfc,0xf4f4f4f4,0x20202020,0xfcfcfcfc,0xf4f4f4f4,
  170.    0x00000000,0xe4e4e4e4,0xd8d8d8d8,0x00000000,0xcccccccc,0xc4c4c4c4,
  171.    0x00000000,0xb4b4b4b4,0xacacacac,0x00000000,0x9c9c9c9c,0x9c9c9c9c,
  172.    0x00000000,0x84848484,0x84848484,0x00000000,0x70707070,0x6c6c6c6c,
  173.    0x00000000,0x58585858,0x54545454,0x00000000,0x40404040,0x40404040,
  174.    0x00000000,0xd0d0d0d0,0xfcfcfcfc,0x5c5c5c5c,0xc4c4c4c4,0xfcfcfcfc,
  175.    0x40404040,0xb4b4b4b4,0xfcfcfcfc,0x20202020,0xa0a0a0a0,0xfcfcfcfc,
  176.    0x00000000,0x90909090,0xe4e4e4e4,0x00000000,0x80808080,0xcccccccc,
  177.    0x00000000,0x74747474,0xb4b4b4b4,0x00000000,0x60606060,0x9c9c9c9c,
  178.    0x00000000,0xd8d8d8d8,0xfcfcfcfc,0xd8d8d8d8,0xbcbcbcbc,0xfcfcfcfc,
  179.    0xb8b8b8b8,0x9c9c9c9c,0xfcfcfcfc,0x9c9c9c9c,0x80808080,0xfcfcfcfc,
  180.    0x7c7c7c7c,0x60606060,0xfcfcfcfc,0x5c5c5c5c,0x40404040,0xfcfcfcfc,
  181.    0x40404040,0x20202020,0xfcfcfcfc,0x20202020,0x00000000,0xfcfcfcfc,
  182.    0x00000000,0x00000000,0xffffffff,0x00000000,0x00000000,0xefefefef,
  183.    0x00000000,0x00000000,0xe3e3e3e3,0x00000000,0x00000000,0xd7d7d7d7,
  184.    0x00000000,0x07070707,0xcbcbcbcb,0x00000000,0x07070707,0xbfbfbfbf,
  185.    0x00000000,0x07070707,0xb3b3b3b3,0x00000000,0x07070707,0xa7a7a7a7,
  186.    0x00000000,0x07070707,0x9b9b9b9b,0x00000000,0x07070707,0x8b8b8b8b,
  187.    0x00000000,0x07070707,0x7f7f7f7f,0x00000000,0x07070707,0x73737373,
  188.    0x00000000,0x07070707,0x67676767,0x00000000,0x07070707,0x5b5b5b5b,
  189.    0x00000000,0x07070707,0x4f4f4f4f,0x00000000,0x04040404,0x40404040,
  190.    0x00000000,0xdadadada,0xffffffff,0xffffffff,0xb8b8b8b8,0xfcfcfcfc,
  191.    0xfcfcfcfc,0x9c9c9c9c,0xfcfcfcfc,0xfcfcfcfc,0x7c7c7c7c,0xfcfcfcfc,
  192.    0xf8f8f8f8,0x5c5c5c5c,0xfcfcfcfc,0xfcfcfcfc,0x40404040,0xfcfcfcfc,
  193.    0xfcfcfcfc,0x20202020,0xfcfcfcfc,0xfcfcfcfc,0x00000000,0xfcfcfcfc,
  194.    0xfcfcfcfc,0x00000000,0xe4e4e4e4,0xe4e4e4e4,0x00000000,0xcccccccc,
  195.    0xcccccccc,0x00000000,0xb4b4b4b4,0xb4b4b4b4,0x00000000,0x9c9c9c9c,
  196.    0x9c9c9c9c,0x00000000,0x84848484,0x84848484,0x00000000,0x70707070,
  197.    0x70707070,0x00000000,0x58585858,0x58585858,0x00000000,0x40404040,
  198.    0x40404040,0x5c5c5c5c,0xbcbcbcbc,0xfcfcfcfc,0x40404040,0xb0b0b0b0,
  199.    0xfcfcfcfc,0x20202020,0xa8a8a8a8,0xfcfcfcfc,0x00000000,0x9c9c9c9c,
  200.    0xfcfcfcfc,0x00000000,0x8c8c8c8c,0xe4e4e4e4,0x00000000,0x7c7c7c7c,
  201.    0xcccccccc,0x00000000,0x6c6c6c6c,0xb4b4b4b4,0x00000000,0x5c5c5c5c,
  202.    0x9c9c9c9c,0xdadadada,0xdadadada,0xffffffff,0xbabababa,0xbfbfbfbf,
  203.    0xffffffff,0x9f9f9f9f,0x9f9f9f9f,0xffffffff,0x7f7f7f7f,0x80808080,
  204.    0xffffffff,0x5f5f5f5f,0x60606060,0xffffffff,0x40404040,0x40404040,
  205.    0xffffffff,0x20202020,0x25252525,0xffffffff,0x00000000,0x05050505,
  206.    0xffffffff,0x00000000,0x00000000,0xffffffff,0x00000000,0x00000000,
  207.    0xefefefef,0x00000000,0x00000000,0xe3e3e3e3,0x00000000,0x00000000,
  208.    0xd7d7d7d7,0x00000000,0x00000000,0xcbcbcbcb,0x00000000,0x00000000,
  209.    0xbfbfbfbf,0x00000000,0x00000000,0xb3b3b3b3,0x00000000,0x00000000,
  210.    0xa7a7a7a7,0x00000000,0x00000000,0x9b9b9b9b,0x00000000,0x00000000,
  211.    0x8b8b8b8b,0x00000000,0x00000000,0x7f7f7f7f,0x00000000,0x00000000,
  212.    0x73737373,0x00000000,0x00000000,0x67676767,0x00000000,0x00000000,
  213.    0x5b5b5b5b,0x00000000,0x00000000,0x4f4f4f4f,0x00000000,0x00000000,
  214.    0x40404040,0xf0f0f0f0,0xdadadada,0xffffffff,0xe5e5e5e5,0xbabababa,
  215.    0xffffffff,0xdadadada,0x9f9f9f9f,0xffffffff,0xd0d0d0d0,0x7f7f7f7f,
  216.    0xffffffff,0xcacacaca,0x5f5f5f5f,0xffffffff,0xbfbfbfbf,0x40404040,
  217.    0xffffffff,0xb5b5b5b5,0x20202020,0xffffffff,0xaaaaaaaa,0x00000000,
  218.    0xffffffff,0x9a9a9a9a,0x00000000,0xe5e5e5e5,0x80808080,0x00000000,
  219.    0xcfcfcfcf,0x75757575,0x00000000,0xb5b5b5b5,0x60606060,0x00000000,
  220.    0x9f9f9f9f,0x50505050,0x00000000,0x85858585,0x45454545,0x00000000,
  221.    0x70707070,0x35353535,0x00000000,0x5a5a5a5a,0x2a2a2a2a,0x00000000,
  222.    0x40404040,0xffffffff,0xdadadada,0xffffffff,0xffffffff,0xbabababa,
  223.    0xffffffff,0xffffffff,0x9f9f9f9f,0xffffffff,0xffffffff,0x7f7f7f7f,
  224.    0xffffffff,0xffffffff,0x5f5f5f5f,0xffffffff,0xffffffff,0x40404040,
  225.    0xffffffff,0xffffffff,0x20202020,0xffffffff,0xffffffff,0x00000000,
  226.    0xffffffff,0xe0e0e0e0,0x00000000,0xe5e5e5e5,0xcacacaca,0x00000000,
  227.    0xcfcfcfcf,0xb5b5b5b5,0x00000000,0xb5b5b5b5,0x9f9f9f9f,0x00000000,
  228.    0x9f9f9f9f,0x85858585,0x00000000,0x85858585,0x6f6f6f6f,0x00000000,
  229.    0x70707070,0x5a5a5a5a,0x00000000,0x5a5a5a5a,0x40404040,0x00000000,
  230.    0x40404040,0xffffffff,0xe9e9e9e9,0xdededede,0xf7f7f7f7,0xdddddddd,
  231.    0xd0d0d0d0,0xf0f0f0f0,0xd1d1d1d1,0xc3c3c3c3,0xe9e9e9e9,0xc7c7c7c7,
  232.    0xb7b7b7b7,0xe1e1e1e1,0xbabababa,0xaaaaaaaa,0xdadadada,0xb0b0b0b0,
  233.    0x9e9e9e9e,0xd3d3d3d3,0xa4a4a4a4,0x94949494,0xcccccccc,0x9b9b9b9b,
  234.    0x89898989,0xc5c5c5c5,0x90909090,0x80808080,0xbebebebe,0x86868686,
  235.    0x76767676,0xb6b6b6b6,0x7c7c7c7c,0x6b6b6b6b,0xafafafaf,0x73737373,
  236.    0x63636363,0xa8a8a8a8,0x6b6b6b6b,0x5a5a5a5a,0xa1a1a1a1,0x61616161,
  237.    0x52525252,0x9a9a9a9a,0x59595959,0x4a4a4a4a,0x93939393,0x50505050,
  238.    0x43434343,0x8b8b8b8b,0x48484848,0x3b3b3b3b,0x84848484,0x3f3f3f3f,
  239.    0x34343434,0x7e7e7e7e,0x39393939,0x2e2e2e2e,0x77777777,0x31313131,
  240.    0x28282828,0x70707070,0x2c2c2c2c,0x23232323,0x69696969,0x26262626,
  241.    0x1d1d1d1d,0x61616161,0x1f1f1f1f,0x18181818,0x5a5a5a5a,0x1b1b1b1b,
  242.    0x14141414,0x53535353,0x15151515,0x10101010,0x4c4c4c4c,0x11111111,
  243.    0x0d0d0d0d,0x45454545,0x0c0c0c0c,0x09090909,0x3e3e3e3e,0x09090909,
  244.    0x07070707,0x36363636,0x05050505,0x04040404,0x2f2f2f2f,0x03030303,
  245.    0x02020202,0x28282828,0x01010101,0x01010101,0x21212121,0x00000000,
  246.    0x00000000,0xffffffff,0x58585858,0x58585858,0xffffffff,0xbebebebe,
  247.    0x80808080,0xffffffff,0xfefefefe,0x82828282,0x82828282,0xffffffff,
  248.    0x84848484,0x80808080,0xffffffff,0xffffffff,0x80808080,0x80808080,
  249.    0xffffffff,0xbfbfbfbf,0x80808080,0xffffffff,0xfefefefe,0x80808080,
  250.    0xffffffff,0xc7c7c7c7,0x2b2b2b2b,0x2b2b2b2b,0xc7c7c7c7,0x4f4f4f4f,
  251.    0x2b2b2b2b,0xc7c7c7c7,0x77777777,0x2b2b2b2b,0xc7c7c7c7,0x9f9f9f9f,
  252.    0x2b2b2b2b,0xc7c7c7c7,0xc7c7c7c7,0x2b2b2b2b,0x9f9f9f9f,0xc7c7c7c7,
  253.    0x2b2b2b2b,0x77777777,0xc7c7c7c7,0x2b2b2b2b,0x4f4f4f4f,0xc7c7c7c7,
  254.    0x2b2b2b2b,0x2b2b2b2b,0xc7c7c7c7,0x33333333,0x2b2b2b2b,0xc7c7c7c7,
  255.    0x5f5f5f5f,0x2b2b2b2b,0xc7c7c7c7,0x8b8b8b8b,0x2b2b2b2b,0xc7c7c7c7,
  256.    0xb7b7b7b7,0x2b2b2b2b,0xabababab,0xc7c7c7c7,0x2b2b2b2b,0x7f7f7f7f,
  257.    0xc7c7c7c7,0x2b2b2b2b,0x53535353,0xc7c7c7c7,0x2f2f2f2f,0x2b2b2b2b,
  258.    0xc7c7c7c7,0x5b5b5b5b,0x2b2b2b2b,0xc7c7c7c7,0x87878787,0x2b2b2b2b,
  259.    0xc7c7c7c7,0xb3b3b3b3,0x2b2b2b2b,0xc7c7c7c7,0xc7c7c7c7,0x2b2b2b2b,
  260.    0xafafafaf,0xc7c7c7c7,0x2b2b2b2b,0x83838383,0xc7c7c7c7,0x2b2b2b2b,
  261.    0x57575757,0xc7c7c7c7,0x2b2b2b2b,0x2b2b2b2b,0xffffffff,0xffffffff,
  262.    0xffffffff,0x00000000,
  263. };
  264. unsigned long RGB8bit[] =
  265. {
  266.    0x00c7ffff,0x00a0a0a0,0x0000aa00,0x0000aaaa,0x00aa0000,0x00aa00aa,
  267.    0x00aa5500,0x00aaaaaa,0x00555555,0x005555ff,0x0055ff55,0x0055ffff,
  268.    0x00ff5555,0x00ff55ff,0x00ffff55,0x00ffffff,0x00efefef,0x00dfdfdf,
  269.    0x00d3d3d3,0x00c3c3c3,0x00b7b7b7,0x00ababab,0x009b9b9b,0x008f8f8f,
  270.    0x007f7f7f,0x00737373,0x00676767,0x00575757,0x004b4b4b,0x003b3b3b,
  271.    0x002f2f2f,0x00232323,0x00ff0000,0x00ef0000,0x00e30000,0x00d70000,
  272.    0x00cb0000,0x00bf0000,0x00b30000,0x00a70000,0x009b0000,0x008b0000,
  273.    0x007f0000,0x00730000,0x00670000,0x005b0000,0x004f0000,0x00400000,
  274.    0x00ffdada,0x00ffbaba,0x00ff9f9f,0x00ff7f7f,0x00ff5f5f,0x00ff4040,
  275.    0x00ff2020,0x00ff0000,0x00fca85c,0x00fc9840,0x00fc8820,0x00fc7800,
  276.    0x00e46c00,0x00cc6000,0x00b45400,0x009c4c00,0x00fcfcd8,0x00fcfcb8,
  277.    0x00fcfc9c,0x00fcfc7c,0x00fcf85c,0x00fcf440,0x00fcf420,0x00fcf400,
  278.    0x00e4d800,0x00ccc400,0x00b4ac00,0x009c9c00,0x00848400,0x00706c00,
  279.    0x00585400,0x00404000,0x00d0fc5c,0x00c4fc40,0x00b4fc20,0x00a0fc00,
  280.    0x0090e400,0x0080cc00,0x0074b400,0x00609c00,0x00d8fcd8,0x00bcfcb8,
  281.    0x009cfc9c,0x0080fc7c,0x0060fc5c,0x0040fc40,0x0020fc20,0x0000fc00,
  282.    0x0000ff00,0x0000ef00,0x0000e300,0x0000d700,0x0007cb00,0x0007bf00,
  283.    0x0007b300,0x0007a700,0x00079b00,0x00078b00,0x00077f00,0x00077300,
  284.    0x00076700,0x00075b00,0x00074f00,0x00044000,0x00daffff,0x00b8fcfc,
  285.    0x009cfcfc,0x007cfcf8,0x005cfcfc,0x0040fcfc,0x0020fcfc,0x0000fcfc,
  286.    0x0000e4e4,0x0000cccc,0x0000b4b4,0x00009c9c,0x00008484,0x00007070,
  287.    0x00005858,0x00004040,0x005cbcfc,0x0040b0fc,0x0020a8fc,0x00009cfc,
  288.    0x00008ce4,0x00007ccc,0x00006cb4,0x00005c9c,0x00dadaff,0x00babfff,
  289.    0x009f9fff,0x007f80ff,0x005f60ff,0x004040ff,0x002025ff,0x000005ff,
  290.    0x000000ff,0x000000ef,0x000000e3,0x000000d7,0x000000cb,0x000000bf,
  291.    0x000000b3,0x000000a7,0x0000009b,0x0000008b,0x0000007f,0x00000073,
  292.    0x00000067,0x0000005b,0x0000004f,0x00000040,0x00f0daff,0x00e5baff,
  293.    0x00da9fff,0x00d07fff,0x00ca5fff,0x00bf40ff,0x00b520ff,0x00aa00ff,
  294.    0x009a00e5,0x008000cf,0x007500b5,0x0060009f,0x00500085,0x00450070,
  295.    0x0035005a,0x002a0040,0x00ffdaff,0x00ffbaff,0x00ff9fff,0x00ff7fff,
  296.    0x00ff5fff,0x00ff40ff,0x00ff20ff,0x00ff00ff,0x00e000e5,0x00ca00cf,
  297.    0x00b500b5,0x009f009f,0x00850085,0x006f0070,0x005a005a,0x00400040,
  298.    0x00ffe9de,0x00f7ddd0,0x00f0d1c3,0x00e9c7b7,0x00e1baaa,0x00dab09e,
  299.    0x00d3a494,0x00cc9b89,0x00c59080,0x00be8676,0x00b67c6b,0x00af7363,
  300.    0x00a86b5a,0x00a16152,0x009a594a,0x00935043,0x008b483b,0x00843f34,
  301.    0x007e392e,0x00773128,0x00702c23,0x0069261d,0x00611f18,0x005a1b14,
  302.    0x00531510,0x004c110d,0x00450c09,0x003e0907,0x00360504,0x002f0302,
  303.    0x00280101,0x00210000,0x00ff5858,0x00ffbe80,0x00fffe82,0x0082ff84,
  304.    0x0080ffff,0x008080ff,0x00bf80ff,0x00fe80ff,0x00c72b2b,0x00c74f2b,
  305.    0x00c7772b,0x00c79f2b,0x00c7c72b,0x009fc72b,0x0077c72b,0x004fc72b,
  306.    0x002bc733,0x002bc75f,0x002bc78b,0x002bc7b7,0x002babc7,0x002b7fc7,
  307.    0x002b53c7,0x002f2bc7,0x005b2bc7,0x00872bc7,0x00b32bc7,0x00c72baf,
  308.    0x00c72b83,0x00c72b57,0x00c72b2b,0x00000000
  309. };
  310. struct rl_RGB palette[256];
  311.  
  312. short ground_points[] =
  313. {
  314.    2, 0, 0,   1, 0, 0,   1, 0, -1,   2, 0, -1,   1, 0, -2,   2, 0, -2, 
  315.    0, 0, -1,  -1, 0, -1, -1, 0, -2,  0, 0, -2,   0, 0, 0,    -1, 0, 0, 
  316.    -2, 0, 0,  -2, 0, -1, -2, 0, -2,  1, 0, 2,    0, 0, 2,    0, 0, 1, 
  317.    1, 0, 1,   -1, 0, 1,  -2, 0, 1,   -1, 0, 2,   -2, 0, 2,   2, 0, 1, 
  318.    2, 0, 2 
  319. };
  320.  
  321. short ground_poly[] =
  322. {
  323.    16,
  324.    4, 3, 2, 1, 0, 2,     4, 5, 4, 2, 3, 2,     4, 9, 8, 7, 6, 2,
  325.    4, 6, 7, 11, 10, 2,   4, 7, 13, 12, 11, 2,  4, 8, 14, 13, 7, 2,
  326.    4, 4, 9, 6, 2, 2,     4, 2, 6, 10, 1, 2,    4, 18, 17, 16, 15, 2,
  327.    4, 1, 10, 17, 18, 2,  4, 11, 12, 20, 19, 2, 4, 19, 20, 22, 21, 2,
  328.    4, 17, 19, 21, 16, 2, 4, 10, 11, 19, 17, 2, 4, 0, 1, 18, 23, 2,
  329.    4, 23, 18, 15, 24, 2
  330. };
  331.  
  332. short pino_points[] =
  333. {
  334.    8, 84, 8,    16, 74, 16,    18, 62, 18,    16, 50, 16,    4, 40, 4,
  335.    10, 86, 2,   22, 74, 0,     26, 64, 0,     22, 48, -2,    4, 40, 0,
  336.    10, 84, -8,  14, 76, -14,   18, 64, -18,   14, 48, -16,   4, 40, -4,
  337.    -2, 86, -10, 2, 74, -20,    -2, 60, -24,   0, 50, -20,    0, 40, -4,
  338.    -8, 84, -8,  -14, 74, -16,  -18, 62, -18,  -16, 50, -16,  -4, 40, -4,
  339.    -12, 84, 0,  -22, 74, -2,   -24, 62, -2,   -20, 48, -2,   -4, 40, 0,
  340.    -8, 84, 6,   -16, 72, 14,   -18, 62, 18,   -16, 50, 18,   -4, 40, 4,
  341.    0, 88, 0,    2, 82, 12,     0, 74, 22,     2, 62, 26,     2, 48, 20,
  342.    0, 40, 4,    4, 20, 4,      4, 0, 4,       6, 20, 0,      6, 0, 0,
  343.    4, 20, -4,   4, 0, -4,      0, 20, -6,     0, 0, -6,      -4, 20, -4,
  344.    -4, 0, -4,   -4, 20, 0,     -6, 0, 0,      -4, 20, 4,     -4, 0, 4,
  345.    0, 20, 4,    0, 0, 6
  346. };
  347.  
  348. short pino_poly[] =
  349. {
  350.    56,
  351.    3, 36, 0, 35, 10,        4, 37, 1, 0, 36, 10,     4, 38, 2, 1, 37, 10,
  352.    4, 39, 3, 2, 38, 10,     4, 40, 4, 3, 39, 10,     3, 0, 5, 35, 10,
  353.    4, 1, 6, 5, 0, 10,       4, 2, 7, 6, 1, 10,       4, 3, 8, 7, 2, 10,
  354.    4, 4, 9, 8, 3, 10,       3, 5, 10, 35, 10,        4, 6, 11, 10, 5, 10,
  355.    4, 7, 12, 11, 6, 10,     4, 8, 13, 12, 7, 10,     4, 9, 14, 13, 8, 10,
  356.    3, 10, 15, 35, 10,       4, 11, 16, 15, 10, 10,   4, 12, 17, 16, 11, 10,
  357.    4, 13, 18, 17, 12, 10,   4, 14, 19, 18, 13, 10,   3, 15, 20, 35, 10,
  358.    4, 16, 21, 20, 15, 10,   4, 17, 22, 21, 16, 10,   4, 18, 23, 22, 17, 10,
  359.    4, 19, 24, 23, 18, 10,   3, 20, 25, 35, 10,       4, 21, 26, 25, 20, 10,
  360.    4, 22, 27, 26, 21, 10,   4, 23, 28, 27, 22, 10,   4, 24, 29, 28, 23, 10,
  361.    3, 25, 30, 35, 10,       4, 26, 31, 30, 25, 10,   4, 27, 32, 31, 26, 10,
  362.    4, 28, 33, 32, 27, 10,   4, 29, 34, 33, 28, 10,   3, 30, 36, 35, 10,
  363.    4, 31, 37, 36, 30, 10,   4, 32, 38, 37, 31, 10,   4, 33, 39, 38, 32, 10,
  364.    4, 34, 40, 39, 33, 10,   4, 55, 41, 4, 40, 6,     4, 56, 42, 41, 55, 6,
  365.    4, 41, 43, 9, 4, 6,      4, 42, 44, 43, 41, 6,    4, 43, 45, 14, 9, 6,
  366.    4, 44, 46, 45, 43, 6,    4, 45, 47, 19, 14, 6,    4, 46, 48, 47, 45, 6,
  367.    4, 47, 49, 24, 19, 6,    4, 48, 50, 49, 47, 6,    4, 49, 51, 29, 24, 6,
  368.    4, 50, 52, 51, 49, 6,    4, 51, 53, 34, 29, 6,    4, 52, 54, 53, 51, 6,
  369.    4, 53, 55, 40, 34, 6,    4, 54, 56, 55, 53, 6
  370. };
  371.  
  372. short cartello_points[] =
  373. {
  374.    2, 8, 0,    3, 0, 0,    -1, 0, 0,    -2, 8, 0,    10, 9, 0,
  375.    9, 18, 0,   -11, 16, 0, -10, 7, 0
  376. };
  377.  
  378. short cartello_poly[] =
  379. {
  380.    4,
  381.    4, 3, 2, 1, 0, 6,  4, 3, 0, 1, 2, 6,  4, 4, 5, 6, 7, 14,  4, 4, 7, 6, 5, 14
  382. };
  383.  
  384. short pozzo_points[] =
  385. {
  386.    3, 13, -1,   3, 13, 1,   3, 6, 1,   3, 6, -1,   -3, 13, -1,   -3, 13, 1, 
  387.    -3, 6, 1,    -3, 6, -1,  -6, 12, 6, 6, 12, 6,   -6, 12, -6,   6, 12, -6, 
  388.    6, 15, 0,    -6, 15, 0,  3, 0, -3,  3, 0, 3,    -3, 0, 3,     -3, 0, -3, 
  389.    3, 6, -3,    3, 6, 3,    -3, 6, 3,  -3, 6, -3,  -5, 6, 5,     5, 6, 5, 
  390.    5, 6, -5,    -5, 6, -5,  -5, 5, 5,  5, 5, 5,    5, 5, -5,     -5, 5, -5, 
  391.    4, 5, -4,    -4, 5, -4,  -4, 5, 4,  4, 5, 4,    5, 0, -5,     -5, 0, -5, 
  392.    -5, 0, 5,    5, 0, 5
  393. };
  394.  
  395. short pozzo_poly[] =
  396. {
  397.    25,
  398.    4, 3, 2, 1, 0, 6,   4, 3, 0, 1, 2, 6,       4, 7, 6, 5, 4, 6,
  399.    4, 7, 4, 5, 6, 6,   4, 12, 13, 10, 11, 6,   4, 12, 11, 10, 13, 6,
  400.    4, 13, 8, 9, 12, 6, 4, 13, 12, 9, 8, 6,     4, 15, 16, 20, 19, 5,
  401.    4, 14, 18, 21, 17, 5,   4, 14, 15, 19, 18, 5,   4, 17, 21, 20, 16, 5,
  402.    4, 14, 17, 16, 15, 255, 4, 23, 19, 20, 22, 15,  4, 24, 18, 19, 23, 15,
  403.    4, 25, 21, 18, 24, 15,  4, 25, 22, 20, 21, 15,  4, 24, 28, 29, 25, 15,
  404.    4, 26, 27, 23, 22, 15,  4, 22, 25, 29, 26, 15,  4, 28, 24, 23, 27, 15,
  405.    4, 34, 35, 31, 30, 7,   4, 32, 31, 35, 36, 7,   4, 37, 34, 30, 33, 7,
  406.    4, 36, 37, 33, 32, 7
  407. };
  408.  
  409. short bat_points[] =
  410. {
  411.    39, -6, -8, 30, -10, -8, 49, -9, -8, 46, 12, -4, 41, 3, -8, 30, 6, -8,
  412.    30, 25, -2, 15, 5, -6, -41, 3, -8, -30, 6, -8, -30, -10, -8, -39, -6, -8,
  413.    -49, -9, -8, -46, 12, -4, -30, 25, -2, -15, 5, -6, -13, 12, -5, -18, 0, -8,
  414.    -13, -12, -5, -13, 12, 5, -18, 0, 8, -13, -12, 5, -5, 12, 13, -8, 0, 18,
  415.    -5, -12, 13, 5, 12, 13, 8, 0, 18, 5, -12, 13, 13, 12, 5, 18, 0, 8,
  416.    13, -12, 5, 13, 12, -5, 18, 0, -8, 13, -12, -5, 5, 12, -13, 8, 0, -18,
  417.    5, -12, -13, 0, 18, 0, -5, 12, -13, -8, 0, -18, -5, -12, -13, 0, -18, 0,
  418.    0, 15, 8, 0, 5, 8, 3, 15, 18, 3, 5, 18, 13, 15, 18, 13, 5, 18, 16, 15, 8,
  419.    16, 5, 8, 8, 20, 11, 8, 15, 2, 8, 5, 2, 8, 0, 11, -16, 15, 8, -16, 5, 8,
  420.    -13, 15, 18, -13, 5, 18, -3, 15, 18, -3, 5, 18, -8, 20, 11, -8, 15, 2,
  421.    -8, 5, 2, -8, 0, 11
  422. };
  423.  
  424. short bat_poly[] =
  425. {
  426.   90,
  427.    3, 6, 3, 4, 4,   3, 6, 4, 5, 4,   3, 6, 4, 3, 4,   3, 6, 5, 4, 4,
  428.    3, 0, 4, 2, 4,   3, 5, 4, 0, 4,   3, 5, 0, 1, 4,   3, 7, 5, 1, 4,
  429.    3, 0, 2, 4, 4,   3, 5, 0, 4, 4,   3, 5, 1, 0, 4,   3, 7, 1, 5, 4,
  430.    3, 4, 3, 2, 4,   3, 7, 6, 5, 4,   3, 4, 2, 3, 4,   3, 7, 5, 6, 4,
  431.    3, 42, 61, 60, 15,  3, 63, 43, 59, 15,  4, 59, 43, 42, 58, 15,
  432.    3, 58, 42, 60, 15,  3, 63, 59, 57, 15,  4, 57, 59, 58, 56, 255,
  433.    3, 56, 58, 60, 15,  3, 63, 57, 55, 15,  4, 55, 57, 56, 54, 15,
  434.    3, 54, 56, 60, 15,  3, 63, 55, 62, 15,  4, 62, 55, 54, 61, 15,
  435.    3, 61, 54, 60, 15,  3, 53, 52, 49, 15,  4, 49, 52, 51, 48, 15,
  436.    3, 48, 51, 50, 15,  3, 53, 49, 47, 15,  4, 47, 49, 48, 46, 15,
  437.    3, 46, 48, 50, 15,  3, 53, 47, 45, 15,  4, 45, 47, 46, 44, 255,
  438.    3, 44, 46, 50, 15,  3, 53, 45, 43, 15,  4, 43, 45, 44, 42, 15,
  439.    3, 42, 44, 50, 15,  3, 51, 42, 50, 15,  3, 41, 40, 36, 6,
  440.    4, 36, 40, 39, 35, 6,  4, 35, 39, 38, 34, 6,  3, 34, 38, 37, 6,  3, 41, 36, 33, 6,
  441.    4, 33, 36, 35, 32, 6,  4, 32, 35, 34, 31, 6,  3, 31, 34, 37, 6,  3, 41, 33, 30, 6,
  442.    4, 30, 33, 32, 29, 6,  4, 29, 32, 31, 28, 6,  3, 28, 31, 37, 6,  3, 41, 30, 27, 6,
  443.    4, 27, 30, 29, 26, 6,  4, 26, 29, 28, 25, 6,  3, 25, 28, 37, 6,  3, 41, 27, 24, 6,
  444.    4, 24, 27, 26, 23, 6,  4, 23, 26, 25, 22, 6,  3, 22, 25, 37, 6,  3, 41, 24, 21, 6,
  445.    4, 21, 24, 23, 20, 6,  4, 20, 23, 22, 19, 6,  3, 19, 22, 37, 6,  3, 41, 21, 18, 6,
  446.    4, 18, 21, 20, 17, 6,  4, 17, 20, 19, 16, 6,  3, 16, 19, 37, 6,  3, 41, 18, 40, 6,
  447.    4, 40, 18, 17, 39, 6,  4, 39, 17, 16, 38, 6,  3, 38, 16, 37, 6,  3, 15, 14, 9, 4,
  448.    3, 8, 13, 12, 4,  3, 15, 9, 14, 4,  3, 8, 12, 13, 4,  3, 15, 9, 10, 4,
  449.    3, 9, 11, 10, 4,  3, 9, 8, 11, 4,   3, 11, 8, 12, 4,  3, 15, 10, 9, 4,
  450.    3, 9, 10, 11, 4,  3, 9, 11, 8, 4,   3, 11, 12, 8, 4,  3, 14, 8, 9, 4, 
  451.    3, 14, 13, 8, 4,  3, 14, 9, 8, 4,   3, 14, 8, 13, 4
  452. };
  453.  
  454. short cane_points[] =
  455. {
  456.    16, 5, 11,    8, 5, 11,    18, 0, 14,    6, 0, 14,    11, 0, 0,
  457.    6, 0, -10,    18, 0, -10,  8, 5, -13,    16, 5, -13,  11, 0, -24,
  458.    -16, 5, -13,  -8, 5, -13,  -18, 0, -10,  -6, 0, -10,  -11, 0, -24,
  459.    -17, 39, 15,  -13, 37, 23, -8, 42, 14,   17, 39, 15,  13, 37, 23,
  460.    8, 42, 14,    -8, 5, 11,   -16, 5, 11,   -11, 0, 0,   -6, 0, 14,
  461.    -18, 0, 14,   0, 21, -31,  0, 30, -29,   8, 28, 0,    8, 23, 7,
  462.    14, 13, 7,    6, 5, 7,     8, 3, 0,      17, 15, 1,   8, 3, -18,
  463.    8, 28, -18,   17, 15, -20, 0, 16, -27,   -8, 28, -18, -8, 28, 0,
  464.    -17, 15, -20, -17, 15, 1,  -8, 3, -18,   -8, 3, 0,    -8, 23, 7,
  465.    -14, 13, 7,   -6, 5, 7,    0, 19, 34,    -4, 21, 35,  -13, 23, 25,
  466.    -16, 23, 15,  -8, 23, 9,   -14, 13, 9,   -17, 13, 18, -6, 5, 9,
  467.    -11, 10, 30,  -4, 11, 36,  -9, 5, 26,    0, 7, 33,    6, 5, 9,
  468.    9, 5, 26,     14, 13, 9,   17, 13, 18,   4, 11, 36,   13, 23, 25,
  469.    4, 21, 35,    11, 10, 30,  0, 23, 31,    0, 26, 35,   0, 33, 15,
  470.    0, 23, 15,    3, 33, 25,   3, 23, 25,    13, 33, 25,  16, 33, 15,
  471.    16, 23, 15,   8, 38, 18,   8, 33, 9,     8, 23, 9,    -16, 33, 15,
  472.    -13, 33, 25,  -3, 33, 25,  -3, 23, 25,   -8, 38, 18,  -8, 33, 9
  473. };
  474.  
  475. short cane_poly[] =
  476. {
  477.    109,
  478.    3, 4, 1, 0, 6,     3, 4, 0, 2, 6,     3, 3, 1, 4, 6,    4, 3, 2, 0, 1, 6,
  479.    3, 4, 2, 3, 6,     3, 9, 6, 5, 6,     4, 5, 6, 8, 7, 6, 3, 5, 7, 9, 6,
  480.    3, 9, 8, 6, 6,     3, 9, 7, 8, 6,     3, 14, 10, 11, 6, 3, 14, 12, 10, 6,
  481.    3, 13, 14, 11, 6,  4, 13, 11, 10, 12, 6,                3, 14, 13, 12, 6,
  482.    3, 17, 16, 15, 6,  3, 17, 15, 16, 6,  3, 20, 19, 18, 6, 3, 20, 18, 19, 6,
  483.    3, 23, 24, 25, 6,  4, 24, 21, 22, 25, 6,                3, 24, 23, 21, 6,
  484.    3, 23, 25, 22, 6,  3, 23, 22, 21, 6,  3, 27, 26, 37, 6,
  485.    3, 27, 37, 26, 6,  4, 43, 32, 31, 46, 6,                4, 39, 44, 29, 28, 6,
  486.    4, 38, 39, 28, 35, 6,                 4, 42, 34, 32, 43, 6,
  487.    3, 37, 38, 35, 6,  3, 37, 34, 42, 6,  4, 36, 35, 28, 33, 6,
  488.    4, 36, 33, 32, 34, 6,                 4, 33, 28, 29, 30, 6,
  489.    4, 33, 30, 31, 32, 6,                 3, 37, 36, 34, 6,
  490.    3, 37, 35, 36, 6,  3, 37, 40, 38, 6,  3, 37, 42, 40, 6, 4, 41, 43, 46, 45, 6,
  491.    4, 41, 45, 44, 39, 6, 4, 40, 42, 43, 41, 6,             4, 40, 41, 39, 38, 6,
  492.    4, 78, 29, 44, 51, 14,                4, 30, 29, 78, 61, 14,
  493.    4, 59, 31, 30, 61, 14,                4, 46, 31, 59, 54, 14,
  494.    4, 45, 46, 54, 52, 14,                4, 44, 45, 52, 51, 14,
  495.    3, 70, 78, 51, 6,  4, 54, 59, 60, 57, 6,                 3, 57, 60, 58, 6,
  496.    3, 58, 63, 56, 6,  3, 56, 63, 47, 6,  3, 55, 48, 49, 6,  3, 55, 56, 48, 6,
  497.    3, 56, 47, 48, 6,  3, 49, 53, 55, 6,  3, 53, 49, 50, 6,  3, 50, 52, 53, 6,
  498.    3, 51, 52, 50, 6,  3, 57, 55, 53, 6,  3, 54, 53, 52, 6,  3, 54, 57, 53, 6,
  499.    3, 56, 55, 57, 6,  3, 58, 56, 57, 6,  3, 58, 60, 63, 6,  3, 63, 60, 66, 6,
  500.    3, 59, 62, 60, 6,  3, 59, 61, 62, 6,  3, 60, 62, 66, 6,  3, 78, 75, 61, 6,
  501.    3, 75, 62, 61, 6,  3, 62, 75, 64, 6,  3, 64, 66, 62, 6,  3, 63, 65, 47, 6,
  502.    3, 66, 65, 63, 6,  3, 66, 64, 65, 6,  3, 47, 65, 48, 6,  3, 48, 67, 49, 6,
  503.    3, 67, 82, 49, 6,  3, 65, 64, 67, 6,  3, 67, 64, 72, 6,  3, 67, 72, 82, 6,
  504.    3, 70, 82, 72, 6,  3, 65, 68, 48, 255,3, 65, 67, 68, 255,3, 67, 48, 68, 255,
  505.    4, 70, 51, 84, 69, 6,    3, 69, 84, 83, 6,      4, 82, 70, 69, 81, 15,
  506.    3, 81, 69, 83, 15,       4, 49, 82, 81, 80, 255,3, 80, 81, 83, 15,
  507.    4, 50, 49, 80, 79, 15,   3, 79, 80, 83, 15,     4, 51, 50, 79, 84, 6,
  508.    3, 84, 79, 83, 6,        4, 75, 78, 77, 74, 6,  3, 74, 77, 76, 6,
  509.    4, 64, 75, 74, 73, 15,   3, 73, 74, 76, 15,     4, 72, 64, 73, 71, 255,
  510.    3, 71, 73, 76, 15,       4, 70, 72, 71, 69, 15, 3, 69, 71, 76, 15,
  511.    4, 78, 70, 69, 77, 6,    3, 77, 69, 76, 6
  512. };
  513.  
  514. short player_points[] =
  515. {
  516.    9, -20, 8,    4, -20, 10,    5, -20, -5,    5, -4, -4,    5, -6, 4,
  517.    5, -16, 0,    5, -16, -4,    -5, -6, 4,     -5, -4, -4,   -5, -16, 0,
  518.    -5, -16, -4,  -4, -20, 10,   -9, -20, 8,    -5, -20, -5,  10, -3, -1,
  519.    10, 3, -1,    14, 1, 5,      10, 5, 7,      10, -5, 7,    -14, 1, 5,
  520.    -10, 5, 7,    -10, -5, 7,    -10, -3, -1,   -10, 3, -1,   0, -12, -13,
  521.    12, -13, -11, -12, -13, -11, 10, 6, -9,     -10, 6, -9,   0, 17, -1,
  522.    -8, -6, -8,   -10, 5, -7,    -8, 2, 8,      10, 5, -7,    8, -6, -8,
  523.    0, -13, 2,    8, 2, 8,       -11, 21, 11,   -10, 25, -11, 10, 25, -11,
  524.    11, 21, 11,   0, 30, 12,     0, 45, -1,     0, 35, -1,    3, 45, 9,
  525.    3, 35, 9,     13, 45, 9,     13, 35, 9,     16, 45, -1,   16, 35, -1,
  526.    8, 50, 2,     8, 45, -7,     8, 35, -7,     8, 30, 2,     -16, 45, -1,
  527.    -16, 35, -1,  -13, 45, 9,    -13, 35, 9,    -3, 45, 9,    -3, 35, 9,
  528.    -8, 50, 2,    -8, 45, -7,    -8, 35, -7,    -8, 30, 2
  529. };
  530.  
  531. short player_poly[] =
  532. {
  533.    84,
  534.    3, 42, 61, 60, 15,    3, 63, 43, 59, 15,    4, 59, 43, 42, 58, 15,
  535.    3, 58, 42, 60, 15,    3, 63, 59, 57, 15,    4, 57, 59, 58, 56, 255,
  536.    3, 56, 58, 60, 15,    3, 63, 57, 55, 15,    4, 55, 57, 56, 54, 15,
  537.    3, 54, 56, 60, 15,    3, 63, 55, 62, 15,    4, 62, 55, 54, 61, 15,
  538.    3, 61, 54, 60, 15,    3, 53, 52, 49, 15,    4, 49, 52, 51, 48, 15,
  539.    3, 48, 51, 50, 15,    3, 53, 49, 47, 15,    4, 47, 49, 48, 46, 15,
  540.    3, 46, 48, 50, 15,    3, 53, 47, 45, 15,    4, 45, 47, 46, 44, 255,
  541.    3, 44, 46, 50, 15,    3, 53, 45, 43, 15,    4, 43, 45, 44, 42, 15,
  542.    3, 42, 44, 50, 15,    3, 51, 42, 50, 15,    3, 42, 62, 61, 15,
  543.    3, 42, 51, 52, 15,    3, 42, 52, 62, 10,    4, 39, 38, 62, 52, 10,
  544.    3, 39, 52, 53, 10,    3, 38, 63, 62, 10,    3, 41, 43, 63, 10,
  545.    3, 41, 53, 43, 10,    3, 29, 38, 39, 10,    3, 40, 37, 29, 10,
  546.    3, 37, 38, 29, 10,    3, 29, 39, 40, 10,    3, 37, 63, 38, 10,
  547.    3, 53, 40, 39, 10,    3, 41, 63, 37, 10,    3, 41, 40, 53, 10,
  548.    3, 41, 37, 40, 10,    3, 29, 32, 36, 14,    3, 32, 29, 31, 10,
  549.    3, 29, 36, 33, 10,    3, 32, 35, 36, 14,    3, 30, 32, 31, 10,
  550.    3, 34, 33, 36, 10,    3, 35, 32, 30, 10,    3, 35, 34, 36, 10,
  551.    3, 35, 30, 34, 10,    4, 30, 31, 33, 34, 10, 3, 33, 31, 29, 10,
  552.    3, 29, 27, 28, 12,    3, 29, 28, 27, 12,    3, 28, 24, 26, 12,
  553.    3, 28, 26, 24, 12,    3, 27, 24, 25, 12,    3, 27, 25, 24, 12,
  554.    3, 28, 24, 27, 12,    3, 28, 27, 24, 12,    4, 21, 22, 23, 20, 15,
  555.    3, 22, 19, 23, 15,    3, 22, 21, 19, 15,    3, 23, 19, 20, 15,
  556.    3, 21, 20, 19, 15,    3, 18, 16, 17, 15,    3, 15, 17, 16, 15,
  557.    3, 14, 16, 18, 15,    3, 14, 15, 16, 15,    4, 18, 17, 15, 14, 15,
  558.    3, 13, 11, 12, 14,    3, 12, 11, 9, 10,      4, 13, 12, 9, 10, 10,
  559.    4, 13, 10, 9, 11, 10,  4, 10, 8, 7, 9, 10,    4, 10, 9, 7, 8, 10,
  560.    4, 6, 3, 4, 5, 10,     4, 6, 5, 4, 3, 10,     4, 2, 1, 5, 6, 10,
  561.    4, 2, 6, 5, 0, 10,     3, 0, 5, 1, 10,        3, 2, 0, 1, 14
  562. };
  563.  
  564. void *ground_frame, *ground_obj;
  565. void *pozzo_frame, *pozzo_obj;
  566. void *pino_frame, *pino_obj;
  567. void *cartello_frame, *cartello_obj;
  568. void *bat_frame, *bat_obj;
  569. void *cane_frame, *cane_obj;
  570. void *player_frame, *player_obj;
  571.  
  572. int main (void)
  573. {
  574.    long i, j, k;
  575.    long x, y, z;
  576.    long xp, yp;
  577.    unsigned long memptr;
  578.    long dist;
  579.    long r;
  580.    void * Raster;
  581.    long sn, cs;
  582.    unsigned long joy;
  583.    long dxmouse, dymouse;
  584.    long v;
  585.    long xb, yb, zb, ab, rb;
  586.  
  587.    if ( GfxBase = (void *) OpenLibrary ("graphics.library", 0) )
  588.    {
  589.       if ( IntuitionBase = (void *) OpenLibrary ("intuition.library", 0) )
  590.       {
  591.          if ( GfX3dBase = (void *) OpenLibrary ("gfx3d.library", 0) )
  592.          {
  593.             if ( Raster = (void *) AllocMem ( SIZE , MEMF_CHIP | MEMF_CLEAR ) )
  594.             {
  595.  
  596.                InitBitMap ( &MyBitMap, DEPTH, WIDTH, HEIGHT );
  597.                memptr = (long) Raster;
  598.                for ( k=0 ; k<DEPTH ; k++ )
  599.                {
  600.                   MyBitMap.Planes[k] = (char *) memptr;
  601.                   memptr += BPLSIZE;
  602.                }
  603.  
  604.                MyNewScreen.CustomBitMap = &MyBitMap;
  605.                if ( MyScreen = (void *) OpenScreen (&MyNewScreen) )
  606.                {
  607.                   View = (unsigned long *) ViewAddress();
  608.                   ViewPort = View[0];
  609.  
  610.                   LoadRGB32( ViewPort, &RGB32, 256 );
  611.  
  612.                   SetRGB4( ViewPort, 0, 12, 15, 15 );
  613.                   SetRGB4( ViewPort, 255, 0, 0, 0 );
  614.  
  615.                   for ( k=0 ; k<256 ; k++ )
  616.                   {
  617.                      i = RGB8bit[k];
  618.                      palette[k].Red   = (i >> 16) & 0xFF;
  619.                      palette[k].Green = (i >> 8) & 0xFF;
  620.                      palette[k].Blue  = i & 0xFF;
  621.                   }
  622.  
  623.                   GFXSetShading( GFX_FLAT_SHADING | GFX_DEPTH_SHADING );
  624.  
  625.                   GFXBegin( GFX_ENVIRONMENT );
  626.                      GFXBegin( GFX_SHADETABLE );
  627.                         GFXSteps( 12 );
  628.                         GFXThreshold( 3 );
  629.                         GFXColor( 0xc7ffff );
  630.                         GFXFarClip( 2048 );
  631.                         GFXPalette( (void *) &palette );
  632.                      GFXShadeTable( GFXEnd() );
  633.                      GFXBegin( GFX_OBJECT );
  634.                         ground_frame = BuildFrame( ground_points, ground_poly, GFXFlt( 120 ), 0 );
  635.                         GFXFrame( ground_frame );
  636.                         GFXFarClip( 2048 );
  637.                         GFXPosition( 0, 200, 0 );
  638.                      ground_obj = (void *) GFXEnd();
  639.                      GFXObject( ground_obj );
  640.                   groundenv = (void *) GFXEnd();
  641.  
  642.                   GFXBegin( GFX_ENVIRONMENT );
  643.                      GFXBegin( GFX_SHADETABLE );
  644.                         GFXSteps( 12 );
  645.                         GFXThreshold( 3 );
  646.                         GFXColor( 0xc7ffff );
  647.                         GFXFarClip( 2048 );
  648.                         GFXPalette( (void *) &palette );
  649.                      GFXShadeTable( GFXEnd() );
  650.                      GFXBegin( GFX_OBJECT );
  651.                         pozzo_frame = BuildFrame( pozzo_points, pozzo_poly, GFXFlt( 5 ), 0 );
  652.                         GFXFrame( pozzo_frame );
  653.                         GFXFarClip( 2048 );
  654.                         GFXPosition( 0, 200, 0 );
  655.                      pozzo_obj = (void *) GFXEnd();
  656.                      GFXObject( pozzo_obj );
  657.                      GFXBegin( GFX_OBJECT );
  658.                         pino_frame = BuildFrame( pino_points, pino_poly, GFXFlt( 2 ), 0 );
  659.                         GFXFrame( pino_frame );
  660.                         GFXFarClip( 2048 );
  661.                         GFXPosition( -150, 300, 0 );
  662.                      pino_obj = (void *) GFXEnd();
  663.                      GFXObject( pino_obj );
  664.                      GFXBegin( GFX_OBJECT );
  665.                         cartello_frame = BuildFrame( cartello_points, cartello_poly, GFXFlt( 2 ), 0 );
  666.                         GFXFrame( cartello_frame );
  667.                         GFXFarClip( 2048 );
  668.                         GFXPosition( 50, 100, 0 );
  669.                         GFXDirection( 0, 0, -8 );
  670.                      cartello_obj = (void *) GFXEnd();
  671.                      GFXObject( cartello_obj );
  672.                      GFXBegin( GFX_OBJECT );
  673.                         bat_frame = BuildFrame( bat_points, bat_poly, GFXFlt( 1 ), 0 );
  674.                         GFXFrame( bat_frame );
  675.                         GFXFarClip( 2048 );
  676.                         GFXPosition( 0, 200, 0 );
  677.                      bat_obj = (void *) GFXEnd();
  678.                      GFXObject( bat_obj );
  679.                      GFXBegin( GFX_OBJECT );
  680.                         cane_frame = BuildFrame( cane_points, cane_poly, GFXFlt( 1 ), 0 );
  681.                         GFXFrame( cane_frame );
  682.                         GFXFarClip( 2048 );
  683.                         GFXPosition( 150, 350, 0 );
  684.                         GFXDirection( 0, 0, -20 );
  685.                      cane_obj = (void *) GFXEnd();
  686.                      GFXObject( cane_obj );
  687.                      GFXBegin( GFX_OBJECT );
  688.                         player_frame = BuildFrame( player_points, player_poly, GFXFlt( 1 ), 0 );
  689.                         GFXFrame( player_frame );
  690.                         GFXFarClip( 2048 );
  691.                         GFXPosition( 0, 200, 0 );
  692.                      player_obj = (void *) GFXEnd();
  693.                      GFXObject( player_obj );
  694.                   env = (void *) GFXEnd();
  695.  
  696.                   GFXBegin( GFX_CAMERA );
  697.                      GFXWidth( WIDTH );
  698.                      GFXHeight( HEIGHT );
  699.                      GFXVideoBuffer( Raster );
  700.                      GFXEnvironment( groundenv );
  701.                      GFXFocus( 256 );
  702.                      GFXFarClip( 2048 );
  703.                      GFXAspectRatio( GFXDiv( GFXFlt( 320 ), GFXFlt( WIDTH ) ),
  704.                                            GFXFlt( 1 ),
  705.                                            GFXDiv( GFXFlt( 200 ), GFXFlt( HEIGHT ) ) );
  706.                      GFXDirection( -10, 0, 0 );
  707.                      GFXPosition( 0, 0, 100 );
  708.                   groundcam = (void *) GFXEnd();
  709.  
  710.                   GFXBegin( GFX_CAMERA );
  711.                      GFXWidth( WIDTH );
  712.                      GFXHeight( HEIGHT );
  713.                      GFXVideoBuffer( Raster );
  714.                      GFXShareWorkBuffer( groundcam );
  715.                      GFXEnvironment( env );
  716.                      GFXFocus( 256 );
  717.                      GFXFarClip( 2048 );
  718.                      GFXAspectRatio( GFXDiv( GFXFlt( 320 ), GFXFlt( WIDTH ) ),
  719.                                              GFXFlt( 1 ),
  720.                                              GFXDiv( GFXFlt( 200 ), GFXFlt( HEIGHT ) ) );
  721.                      GFXDirection( -10, 0, 0 );
  722.                      GFXPosition( 0, 0, 100 );
  723.                   cam = (void *) GFXEnd();
  724.  
  725.                   trigonometry = GFXDiv( GFXFlt( 128 ), GFXPi() );
  726.  
  727.                   i = 0;
  728.                   j = 0;
  729.                   k = 0;
  730.                   x = 0;
  731.                   y = 0;
  732.                   v = 2;
  733.                   z = GFXFlt( 100 );
  734.                   xp = GFXFlt( 200 );
  735.                   yp = GFXFlt( 200 );
  736.                   xb = 0;
  737.                   yb = 0;
  738.                   zb = 0;
  739.                   ab = 0;
  740.                   rb = 100;
  741.                   do
  742.                   {
  743.                      sn = GFXSin ( GFXMul ( GFXFlt(ab&255) , trigonometry ) );
  744.                      cs = GFXCos ( GFXMul ( GFXFlt(ab&255) , trigonometry ) );
  745.                      xb = GFXFixMul( rb, sn );
  746.                      yb = GFXFixMul( rb, cs );
  747.                      sn = GFXSin ( GFXMul ( GFXFlt((ab*16)&255) , trigonometry ) );
  748.                      zb = GFXFixMul( 10, sn );
  749.                      ab++;
  750.  
  751.                      dxmouse = ReadDeltaXMouse( 0 );
  752.                      if ( dxmouse > 0 )
  753.                      {
  754.                         k -= dxmouse;
  755.                      }                    
  756.                      if ( dxmouse < 0 )
  757.                      {
  758.                         k -= dxmouse;
  759.                      }                    
  760.  
  761.                      dymouse = ReadDeltaYMouse( 0 );
  762.                      if ( dymouse < 0 )
  763.                      {
  764.                         if ( ( j-=dymouse ) > 40 )
  765.                         {
  766.                            j = 40;
  767.                         }
  768.                      }                    
  769.                      if ( dymouse > 0 )
  770.                      {
  771.                         if ( ( j-=dymouse ) < -40 )
  772.                         {
  773.                            j = -40;
  774.                         }
  775.                      }                    
  776.  
  777.                      joy = ReadJoystick( 0 );
  778.                      if ( joy & 16 )
  779.                      {
  780.                         sn = GFXSin ( GFXMul ( GFXFlt(k&255) , trigonometry ) );
  781.                         cs = GFXCos ( GFXMul ( GFXFlt(k&255) , trigonometry ) );
  782.                         x += GFXFixMul( j/2 , sn );
  783.                         y -= GFXFixMul( j/2 , cs );
  784.                      }
  785.  
  786.                      joy = ReadJoystick ( 1 );
  787.                      if ( joy & 4 )
  788.                      {
  789.                         i-=2;
  790.                      }                 
  791.                      else  
  792.                      {
  793.                         if ( joy & 8 )
  794.                         {
  795.                            i+=2;
  796.                         }                    
  797.                      }
  798.                      if ( joy & 2 )
  799.                      {
  800.                         sn = GFXSin ( GFXMul ( GFXFlt(i&255) , trigonometry ) );
  801.                         cs = GFXCos ( GFXMul ( GFXFlt(i&255) , trigonometry ) );
  802.                         xp -= GFXFixMul( v , sn );
  803.                         yp += GFXFixMul( v , cs );
  804.                      }
  805.                      else
  806.                      {                    
  807.                         if ( joy & 1 )
  808.                         {
  809.                            sn = GFXSin ( GFXMul ( GFXFlt(i&255) , trigonometry ) );
  810.                            cs = GFXCos ( GFXMul ( GFXFlt(i&255) , trigonometry ) );
  811.                            xp += GFXFixMul( v , sn );
  812.                            yp -= GFXFixMul( v , cs );
  813.                         }                    
  814.                      }
  815.  
  816.                      GFXModifyCameraPosition( groundcam , GFXFix( x ) , GFXFix( y ) , GFXFix( z ) );
  817.                      GFXModifyCameraDirection( groundcam , j , dxmouse/2 , k );
  818.                      GFXUpdateScene( groundcam );
  819.  
  820.                      GFXModifyCameraPosition( cam , GFXFix( x ) , GFXFix( y ) , GFXFix( z ) );
  821.                      GFXModifyCameraDirection( cam , j , dxmouse/2 , k );
  822.  
  823.                      GFXModifyObjectPosition( bat_obj, GFXFix( xb ), 200+GFXFix( yb ), 50+GFXFix( zb ) );
  824.                      GFXModifyObjectDirection( bat_obj, 0, 0, 64-ab );
  825.  
  826.                      GFXModifyObjectPosition( player_obj, GFXFix( xp ), GFXFix( yp ), 20 );
  827.                      GFXModifyObjectDirection( player_obj, 0, 0, i );
  828.  
  829.                      GFXUpdateScene( cam );
  830.  
  831.                      GFXUpdateVideoBuffer();
  832.                      GFXClearWorkBuffer();
  833.  
  834.                   } while ( !( joy & 16 ) );
  835.  
  836.                   Delay ( 50 );
  837.                   CloseScreen ( MyScreen );
  838.                }
  839.             FreeMem ( Raster, SIZE );
  840.             }
  841.             CloseLibrary (GfX3dBase);
  842.          }
  843.          CloseLibrary (IntuitionBase);
  844.       }
  845.       CloseLibrary (GfxBase);
  846.    }
  847.    return NULL;
  848. }
  849.  
  850.  
  851.  
  852. unsigned long ReadJoystick (unsigned long joynum)
  853. {
  854.    unsigned long ret = 0;
  855.    unsigned short joy;
  856.    unsigned short * hardware;
  857.    unsigned char * lbutton;
  858.  
  859.    if (joynum == 0)
  860.    {
  861.       hardware = (unsigned short *) 0xDFF00AL;
  862.    }
  863.    else
  864.    {
  865.       hardware = (unsigned short *) 0xDFF00CL;
  866.    }
  867.    joy = * hardware;
  868.  
  869.    ret += (joy >> 1 ^ joy) & 0x0100 ? 1 : 0;
  870.    ret += (joy >> 1 ^ joy) & 0x0001 ? 2 : 0;
  871.    ret += joy & 0x0002 ? 4 : 0;
  872.    ret += joy & 0x0200 ? 8 : 0;
  873.  
  874.    lbutton = (unsigned char *) 0xBFE001;
  875.    joy = * lbutton;
  876.    if (joynum == 0)
  877.    {
  878.       ret += !(joy & 0x0040) ? 16 : 0;
  879.    }
  880.    else
  881.    {
  882.       ret += !(joy & 0x0080) ? 16 : 0;
  883.    }
  884.  
  885.    return ret;
  886. }
  887.  
  888.  
  889.  
  890. long ReadDeltaXMouse (unsigned long portnum)
  891. {
  892.    static char prev=0;
  893.    static char init=0;
  894.    long ret = 0;
  895.    char joy;
  896.    unsigned char * hardware;
  897.  
  898.    if ( portnum == 0 )
  899.    {
  900.       hardware = (unsigned char *) 0xDFF00BL;
  901.    }
  902.    else
  903.    {
  904.       hardware = (unsigned char *) 0xDFF00DL;
  905.    }
  906.    joy = * hardware;
  907.    joy /= 2;
  908.  
  909.    if ( init == 0 )
  910.    {
  911.       prev = joy;
  912.       ret = 0;
  913.       init = 1;
  914.    }
  915.    else
  916.    {
  917.       if ( ( prev>0 && joy>0 ) || ( prev<0 && joy<0 ) )
  918.       {
  919.       ret = joy - prev;
  920.          prev = joy;
  921.       }
  922.       else
  923.       {
  924.       ret = joy + prev;
  925.          prev = -joy;
  926.       }
  927.    }
  928.  
  929.    return ret;
  930. }
  931.  
  932.  
  933.  
  934. long ReadDeltaYMouse (unsigned long portnum)
  935. {
  936.    static char prev=0;
  937.    static char init=0;
  938.    long ret = 0;
  939.    char joy;
  940.    unsigned char * hardware;
  941.  
  942.    if ( portnum == 0 )
  943.    {
  944.       hardware = (unsigned char *) 0xDFF00AL;
  945.    }
  946.    else
  947.    {
  948.       hardware = (unsigned char *) 0xDFF00CL;
  949.    }
  950.    joy = * hardware;
  951.  
  952.    if ( init == 0 )
  953.    {
  954.       prev = joy;
  955.       ret = 0;
  956.       init = 1;
  957.    }
  958.    else
  959.    {
  960.       if ( ( prev>0 && joy>0 ) || ( prev<0 && joy<0 ) )
  961.       {
  962.       ret = joy - prev;
  963.          prev = joy;
  964.       }
  965.       else
  966.       {
  967.       ret = joy + prev;
  968.          prev = -joy;
  969.       }
  970.    }
  971.  
  972.    return ret;
  973. }
  974.  
  975.  
  976.  
  977. void * BuildFrame ( short *points, short *polygons, long scale,
  978.                               long offset )
  979. {
  980.   long i, k;
  981.   long count;
  982.   long n;
  983.   long index;
  984.   long color;
  985.   long x, y, z;
  986.   long x0, y0, z0;
  987.   long x1, y1, z1;
  988.  
  989.   GFXBegin ( GFX_FRAME );
  990.     count = polygons[0];
  991.     index = 1;
  992.     for ( k=1 ; k<=count ; k++ )
  993.     {
  994.       n = polygons[ index ];
  995.       index++;
  996.       color = polygons[ index+n ];
  997.       GFXSetColor ( color+offset );
  998.       x0 = GFXFltMul( scale , points[ polygons[ index ] * 3 ] );
  999.       y0 = GFXFltMul( scale , points[ polygons[ index ] * 3 + 1 ] );
  1000.       z0 = GFXFltMul( scale , points[ polygons[ index ] * 3 + 2 ] );
  1001.       x1 = GFXFltMul( scale , points[ polygons[ index+1 ] * 3 ] );
  1002.       y1 = GFXFltMul( scale , points[ polygons[ index+1 ] * 3 + 1 ] );
  1003.       z1 = GFXFltMul( scale , points[ polygons[ index+1 ] * 3 + 2 ] );
  1004.       i = 2;
  1005.       while ( i<n )
  1006.       {
  1007.         GFXBegin ( GFX_POLYGON );
  1008.           GFXVertex ( x0 , -z0 , y0 );
  1009.           GFXVertex ( x1 , -z1 , y1 );
  1010.           x = GFXFltMul( scale , points[ polygons[ index+i ] * 3 ] );
  1011.           y = GFXFltMul( scale , points[ polygons[ index+i ] * 3 + 1 ] );
  1012.           z = GFXFltMul( scale , points[ polygons[ index+i ] * 3 + 2 ] );
  1013.           i++;
  1014.           GFXVertex ( x , -z , y );
  1015.         GFXPolygon ( GFXEnd () );
  1016.         total++;
  1017.         if ( i<n )
  1018.         {
  1019.           x1 = x;
  1020.           y1 = y;
  1021.           z1 = z;
  1022.         }
  1023.       }
  1024.       index += n+1;
  1025.       }
  1026.   return (void *) GFXEnd ();
  1027. }
  1028.  
  1029.  
  1030.